<template>
	<view>
		<view class="record-item" v-for="item in ticketList" :key="item.id" @click="goDetail(item.id)">
			<view class="item-title">
				<view class="left-border"></view>
				<view class="left">{{ticketType[item['工单类型']]}}</view>
				<view class="right">{{item['创建时间'] | formatTime}}</view>
			</view>
			<view class="item-content">
				<view class="content-top">
					<view>联系人姓名 ：{{item['联系人姓名']}}</view>
					<view class="ticket-status daichuli" v-if="item['延期申请状态'] == 1">待处理</view>
					<view class="ticket-status complete" v-if="item['延期申请状态'] == 2">已通过</view>
					<view class="ticket-status abandon" v-if="item['延期申请状态'] == 3">未通过</view>
					<!-- <view class="handle">待处理</view>
				<view class="handle">处理中</view>
				<view class="handle">已完成</view> -->
				</view>
				<view class="content-center">联系电话 ：{{item['联系人电话']}}</view>
				<view class="content-bottom">
					<view class="address">报事地址 ：{{item['报事位置']}}</view>
					<!-- <view class="transfer">转派单</view> -->
				</view>
				<!-- <view @click="goCancel(item.id)" v-if="item['工单状态'] !== 'completed' && item['工单状态'] !== 'abandoned'" class="cancel">废弃</view> -->
			</view>
		</view>
		<!-- <view class="record-item" @click="goDetail(item.id)" v-for="item in ticketList" :key="item.id">
			<view class="item-title">
				<view class="left-border"></view>
				<view class="left">{{ticketType[item['工单类型']]}}</view>
				<view class="right">{{item['创建时间'] | formatTime}}</view>
			</view>
			<view class="item-content">
				<view class="content-top">
					<view>联系人名 ：{{item['联系人姓名']}}</view>
					<view class="handle">{{desc}}</view>
				</view>
				<view class="content-center">联系电话 ：{{item['联系人电话']}}</view>
				<view class="content-bottom">
					<view class="type">报事地址 ：{{item['报事位置']}}</view>
				</view>
			</view>
		</view> -->
	</view>
	</view>
</template>

<script>
	import TicketItem from '@/components/ticketItem.vue'
	import dayjs from 'dayjs'
	export default {
		props: {
			ticketList: {
				required: true
			},
			desc: {
				type: String
			},
			isShowCancel: {
				type: Boolean,
				default: false
			}
		},
		components: {
			TicketItem
		},
		data() {
			return {
				ticketType: this.$type.ticketType
			}
		},
		methods: {
			goDetail(id) {
				this.$emit('detail', id)
			},
			goCancel(id) {
				this.$emit('cancel', id)
			}
		}
	}
</script>

<style lang="scss">
	.record-item {
		width: 690rpx;
		height: 282rpx;
		background-color: #fff;
		box-shadow: 0px 1rpx 11rpx 1rpx #EEEEEE;
		border-radius: 8rpx;
		margin-top: 20rpx;
		margin-bottom: 15rpx;
		margin-left: 30rpx;

		.item-title {
			display: flex;
			justify-content: space-between;
			padding-right: 20rpx;
			width: 100%;
			height: 71rpx;
			display: flex;
			align-items: center;
			border-bottom: 2rpx solid #eee;
			position: relative;

			// padding-top: 10rpx;
			.left-border {
				width: 6rpx;
				height: 30rpx;
				background-color: #1064E9;
				position: absolute;
				left: 0;
				top: 20rpx;
			}

			.left {
				padding-left: 30rpx;
				color: #333;
				font-weight: bold;
				// margin-right: 230rpx;
			}

			.right {
				color: #333;
				font-size: 28rpx;
			}

			.compete {
				color: #83D065;
				width: 82rpx;
				height: 36rpx;
				font-size: 22rpx;
				border: 2rpx solid #83D065;
				text-align: center;
			}
		}

		.item-content {
			color: #666;
			padding: 20rpx 30rpx;
			font-size: 28rpx;
			position: relative;

			.content-top {
				margin-bottom: 16rpx;
				display: flex;
				justify-content: space-between;

				.handle {
					width: 82rpx;
					height: 36rpx;
					background: #1152FC;
					color: #fff;
					font-size: 22rpx;
					text-align: center;

				}
			}

			.content-center {
				margin-bottom: 20rpx;
				display: flex;
				justify-content: space-between;

				.transfer {
					width: 82rpx;
					height: 36rpx;
					// background: #1152FC;
					color: #1152FC;
					font-size: 22rpx;
					border: 2rpx solid #1152FC;
					text-align: center;
				}
			}

			.content-bottom {
				display: flex;
				justify-content: space-between;

				.transfer {
					width: 82rpx;
					height: 36rpx;
					// background: #1152FC;
					color: #1152FC;
					font-size: 22rpx;
					border: 2rpx solid #1152FC;
					text-align: center;
				}

				.type {
					width: 20em;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}
			}

			.cancel {
				position: absolute;
				right: 30rpx;
				bottom: 10rpx;
				text-align: center;
				line-height: 35rpx;
				width: 80rpx;
				height: 40rpx;
				font-size: 24rpx;
				color: #E57544;
				border: 2rpx solid #E57544;
			}
		}
	}
</style>
